# city_code_finder.py
import json
import os

class CityCodeFinder:
    def __init__(self, json_file_path):
        self.city_code_map = {}
        self.load_city_data(json_file_path)

    def load_city_data(self, json_file_path):
        with open(json_file_path, 'r', encoding='utf-8') as f:
            city_data = json.load(f)
        
        for city in city_data:
            self.city_code_map[city['cityName']] = city['cityCode']

    def get_city_code(self, city_name):
        return self.city_code_map.get(city_name, None)
